package draven;

import java.util.ArrayList;
import java.util.List;

/**
 * 坏人
 */
public class Badman implements Observable {

    ArrayList<Observer> list = new ArrayList();

    @Override
    public void addObserver(Observer observer) {
        list.add(observer);
    }

    @Override
    public void deleteObserver(Observer observer) {
        list.remove(observer);
    }

    @Override
    public void notifyObservers(String message) {
        for (Observer obj : list) {
            obj.invoke(message);
        }
    }

    public void run() {
        notifyObservers("我是坏人，我逃跑了，你抓我啊");
    }
}
